home *** CD-ROM | disk | FTP | other *** search
- /*
- COPYRIGHT (C) 1984-1990 Apple Computer,Inc.
- All rights reserved
- */
-
- #include <types.h>
- #include <memory.h>
- #include <menus.h>
- #include <resources.h>
- #include <lists.h>
- #include <ToolUtils.h>
-
- #include "ResEd.h"
-
- #define IconSize 128
- #define cellInset 8
-
- pascal void DrawIcon (Rect *lRect, Handle theIcon)
-
- {
- PlotIcon(lRect, theIcon);
- }
-
- /* This routine simply looks up in the list at the given cell, extracts the ID and
- gets the resource called for. Returns NIL if not found. Note, this assumes
- the resfile is set up correctly.
- NOTE: This is used by both ICON and ICN# pickers. */
- Handle IconFetch (Cell lCell, ListHandle lHandle, short *id)
- {
- short len = 2;
- short saveResFile;
- Handle tempH;
-
- tempH = NULL;
- saveResFile = CurResFile();
- UseResFile ((*((PickHandle)(*lHandle)->refCon))->rNum);
-
- LGetCell((Ptr)id, &len, lCell, lHandle); /* Get the ID from the list. */
- if (len == 2) { /* ID must be 2 bytes. */
- /* Load the resource since we want to draw it. */
- tempH = Get1Res((*((PickHandle)((*lHandle)->refCon)))->rType, *id);
-
- if (SizeResource(tempH) >= IconSize)
- return tempH;
- }
- UseResFile (saveResFile);
- return tempH;
- }
-
- /* This is the custom drawProc for the list (which contains the resource ID's). It
- simply draws the icon in the given rect and frames a selection rect around it (if
- necessary). */
- pascal void DrawCell(short message, Boolean lSelect, Rect *lRect, Point lCell,
- short lDataOffset, short lDataLen, ListHandle lHandle)
- {
- Handle theIcon;
- short id;
-
- #pragma unused (lDataOffset, lDataLen) /* Not needed here. */
-
- if ((message == lDrawMsg) || (message == lHiliteMsg)) {
- theIcon = IconFetch(lCell, lHandle, &id);
- DrawLDEF (message, lSelect, lRect, theIcon, id, "\p", 32, 32, DrawIcon, lHandle);
- }
- }
-